/*
 * Module 02
 *
 */
package ua.gl.basecamp.tabachnyy.util;

import java.util.*;
import ua.gl.basecamp.tabachnyy.testcase.*;

/**
 * @author yaroslav.tabachnyy@gmail.com
 * @version 1.02
 * @date 14.02.2013
 *
 */
public class PredefinedQuestionListFactory extends QuestionListFactory {

    @Override
    public List<Question> createQuestions() {

        List<Question> questions = new ArrayList<Question>();

        questions.add(new YesNoQuestion("Can inherit classes marked as final?",
                new ArrayList<Answer>() {

                    {
                        add(new Answer("yes", false));
                        add(new Answer("no", true));
                    }
                }));
        questions.add(new YesNoQuestion("Is it possible to change the state " +
                "of an object is determined as final?",
                new ArrayList<Answer>() {

                    {
                        add(new Answer("yes", true));
                        add(new Answer("no", false));
                    }
                }));

        questions.add(new SingleAnswerQuestion("When comparing " +
                "java.io.BufferedWriter to java.io.FileWriter, " +
                "which capability exist as a method in only " +
                "one of the two?",
                new ArrayList<Answer>() {

                    {
                        add(new Answer("closing the stream", false));
                        add(new Answer("flushing the stream", false));
                        add(new Answer("writing to the stream", false));
                        add(new Answer("marking a location in the stream",
                                false));
                        add(new Answer("writing a line separator to " +
                                "the stream", true));
                    }
                }));

        questions.add(new MultipleAnswersQuestion("What is true " +
                "about has-a and is-a relationships? (Choose two)",
                new ArrayList<Answer>() {

                    {
                        add(new Answer("Instance variables can be used " +
                                "when creating a has-a relationship.", true));
                        add(new Answer("Inheritance represents an " +
                                "is-a relationship.", true));
                        add(new Answer("Inheritance represents a has-a " +
                                "relationship.", false));
                        add(new Answer("Instances must be used when " +
                                "creating a has-a relationship.", false));
                    }
                }));

        questions.add(new MultipleAnswersQuestion("Which three " +
                "statements " +
                "concerning the use of the java.io.Serializable interface " +
                "are true? (Choose three)",
                new ArrayList<Answer>() {

                    {
                        add(new Answer("object from classes tha use " +
                                "aggregation cannot be serialized.", false));
                        add(new Answer("An object serialized on one " +
                                "JVM can " +
                                "be deserialized on a different JVM.", true));
                        add(new Answer("The values in fields with the " +
                                "volatile modifier will not survive " +
                                "serialization and deserialization.", false));

                        add(new Answer("The values in field with " +
                                "the transient modifier will not survive " +
                                "serialization and deserialization.", true));

                        add(new Answer("It is legal to serialize an " +
                                "object of a type that has a supertype that " +
                                "does not implement " +
                                "java.io.Serializable", true));
                    }
                }));

        questions.add(new MultipleAnswersQuestion("Which three will" +
                " compile without exception? (Choose three)",
                new ArrayList<Answer>() {

                    {
                        add(new Answer("private synchronized " +
                                "SomeClass a;", false));
                        add(new Answer("void book() " +
                                "{ synchronized () {} }", false));
                        add(new Answer("public synchronized " +
                                "void book() {}", true));
                        add(new Answer("public synchronized(this) " +
                                "void book() {}", false));
                        add(new Answer("public void book() " +
                                "{ synchronized(Cruiser.class) {} }", true));
                        add(new Answer("public void book() " +
                                "{synchronized(a){}}", true));
                    }
                }));

        questions.add(new TypedAnswerQuestion("What type return method equals?",
                new ArrayList<Answer>() {

                    {
                        add(new Answer("boolean", true));
                    }
                }));
        questions.add(new RangeAnswerQuestion("What year was released Java?",
                new ArrayList<Answer>() {

                    {
                        add(new Answer("1995", true));
                    }
                }, 5.0));

        return questions;
    }
}
